import operate from '@dfeidao/atom-nodejs/db/operate';
import { IncomingHttpHeaders } from 'http';
import {productid,systemid } from '../../atom/config';
interface Message {
	project_asset_no: string;
	filter: {
		project_name: string,
		project_no: string,
		assetsname: string,
		asset_classification_no: string,
		asset_classification_name: string,
		asset_grade: string,
		brand_no: string,
		customer_assets: number,
		unitprice: string,
		place: string,
		maintenance_time: string,
		timeout_alert: number,
		remark: string,
		timeout_reminder_time: string
	};
}

export default async function atom(message: Message, action_id: string, session_id: string, headers: IncomingHttpHeaders) {
	const op = operate(action_id, session_id, systemid);
	// 根据项目资产编号修改数据
	op.update('project_assets', { productid, project_asset_no: message.project_asset_no }, message.filter);
	const res = await op.exec();
	return res;
}
